package com.misakyanls.examples.regexp;

import static com.misakyanls.examples.regexp.LoginCheck.checkLogin;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

import org.junit.Test;

public class LoginCheckBehavior {

	@Test
	public void shouldBeCorrectWhenMatches() {
		assertThat(checkLogin("Q.-wwwwwwwwwwwwwwww9"), is(true));
	}

	@Test
	public void shouldBeCorrectWhenContainsOnlyOneLetter() {
		assertThat(checkLogin("Q"), is(true));
	}

	@Test
	public void shouldBeWrongWhenNotStartedWithLetter() {
		assertThat(checkLogin("1S"), is(not(true)));
	}

	@Test
	public void shouldBeWrongWhenNotFinishedWithLetterOrDigit() {
		assertThat(checkLogin("q-"), is(not(true)));
	}

	@Test
	public void shouldBeWrongWhenContainsWrongSymbol() {
		assertThat(checkLogin("q%1"), is(not(true)));
	}

	@Test
	public void shouldBeWrongWhenLessThanOneSymbolLength() {
		assertThat(checkLogin(""), is(not(true)));
	}

	@Test
	public void shouldBeWrongWhenMoreThanTwentySymbolLength() {
		assertThat(checkLogin("qqqqqqqqqqqqqqqqqqqqq"), is(not(true)));
	}

}
